document.write("<script language=javascript src='/tianwebsite/js/MD5.js'></script>");
var baseUrl = "/tianwebsite";
var ajaxUrl = "/tianwebsite";
var IS_DEBUG = 1;

$(document).ready(function () {

    /*input鎻愮ず璇�*/
    $(".inp-fon").focus(function () {
        var oldValue = $(this).val();
        if (oldValue == this.defaultValue) {
            $(this).val("").addClass('focus-fon');
        }
    }).blur(function () {
        var oldValue = $(this).val();
        if (oldValue == "") {
            $(this).val(this.defaultValue).removeClass('focus-fon');;
        }
    });



    function getcommonpage(cllname, id) {
        var xmlhttp;
        if (window.XMLHttpRequest) {
            //  IE7+, Firefox, Chrome, Opera, Safari 娴忚鍣ㄦ墽琛屼唬鐮�
            xmlhttp = new XMLHttpRequest();
        } else {
            // IE6, IE5 娴忚鍣ㄦ墽琛屼唬鐮�
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {}
        }
        var url = encodeURI(baseUrl + "/savecommon/gethtml?Url=" + cllname);
        xmlhttp.open("get", url, true);
        var timestamp = new Date().getTime();
        var AppKey = 'db426a9829e4b49a1dcac7b4162da6b6';
        xmlhttp.setRequestHeader("content-type", "application/json; charset=utf-8");
        xmlhttp.setRequestHeader("timestamp", timestamp);
        xmlhttp.setRequestHeader("sign", hex_md5(AppKey + timestamp));
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4) {
                if ((xmlhttp.status >= 200 && xmlhttp.status < 300) || xmlhttp.status == 304) {
                    var res = xmlhttp.responseText;
                    if (document.getElementById(id)) {
                        if (IS_DEBUG) {
                            document.getElementById(id).innerHTML = res
                        }
                    }
					if(id=="customer"){
						$('.main').append(res);
					}
                    if (id == "left_nav") {
                        check();
                    }
                } else {
                    console.log(xmlhttp.responseText);
                }
            }
        };
        xmlhttp.send();
    };
    var commonlist = [{
            cllaname: "common/html/搴曢儴缁勪欢",
            id: "footer"
        },
        {
            cllaname: "common/html/瀵艰埅鏍�",
            id: "bar"
        },
        {
            cllaname: "common/html/鐧婚檰娉ㄥ唽瀵艰埅",
            id: "login"
        },
        {
            cllaname: "common/html/pc绔揩閫熷鑸�",
            id: "foot_icon_center"
        },
		{
            cllaname: "common/html/Logo",
            id: "logo"
        },
		{
            cllaname: "common/html/pc绔湪绾垮鏈�",
            id: "customer"
        }
		,
        {
            cllaname: "common/html/鐞嗚禂鏈嶅姟pc绔鑸爮",
            id: "left_nav"
        }
    ]
    for (var i = 0; i < commonlist.length; i++) {
        getcommonpage(commonlist[i].cllaname, commonlist[i].id)
    }
    var timer = null
    function check() {
        var nav = window._navigation_activation;
        var nav_li = window._nav_li_activation;
        var dom = document.getElementById("nav_activ_" + nav);
        var dom1 = document.getElementById("li_activ_" + nav_li);
        if (dom) {
            //  鎵цdom鍔犺浇瀹屾垚鍚庣殑鎿嶄綔
            $("#nav_activ_" + nav).addClass("atv");
            $("#li_activ_" + nav_li).addClass("nav_atv");
            $('.loading').fadeOut();
            //  娓呴櫎瀹氭椂鍣�
            if (!timer) {
                clearTimeout(timer)
            }
        } else {
            //  鑷垜璋冪敤
            timer = setTimeout(check, 0)
        }
    }
});

function gohome(){
	window.location.href="/";
};
function goclaim(){
	window.location.href="/claim_process/index.html";
};